package com.zw.design.pattern.creational.structural.facade;

public class GiftExchangService {

    private QualifyService qualifyService=new QualifyService();
    private PointsPaymentService pointsPaymentService=new PointsPaymentService();
    private ShippingService shippingService=new ShippingService();

    public void setPointsPaymentService(PointsPaymentService pointsPaymentService) {
        this.pointsPaymentService = pointsPaymentService;
    }

    public void setQualifyService(QualifyService qualifyService) {
        this.qualifyService = qualifyService;
    }

    public void setShippingService(ShippingService shippingService) {
        this.shippingService = shippingService;
    }

    public void giftExchang(PointsGift pointsGift){
        if (qualifyService.isAvailable(pointsGift)){
            //资格检验通过
            if (pointsPaymentService.pay(pointsGift)){
                //支付积分成功
                String orderNa = shippingService.shipGift(pointsGift);
                System.out.println("orderNa =下单成功 " + orderNa);
            }
        }
    }
}
